<template>
    <div>
        <div class="body">
        <div class="body-box">
            <div class="body-left">
                <div class="input-item">
                    <label>用    户    名</label>
                    <txt class="txt">您的账号名和密码</txt>
                    <input id="account" name="account" type="text" class="field" v-model="account">
                    </div>
                <div class="input-item">
                    <label>密     码</label>
                    <txt class="txt">您的账号名和密码</txt>
                    <input id="password" name="password" type="text" class="field" v-model="password">
                    </div>
                <div class="input-item loginact">
                    <a href="javascript:;" class="login" v-on:click="login">立即登入</a>
                    </div>
                </div>
            <div class="body-right">
                <div class="login-right-box">
                    <div class="font">
                        <strong>还没有账号:&nbsp;请<a href="javascript:;" v-on:click="register">&nbsp;注册</a></strong>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import request from '../link/request.js'
export default {
  name: 'Login',
  data () {
    return {
      account: '',
      password: ''
    }
  },
  methods: {
    login: function (res) {
      let that = this
      request.post('/index.php/main/login/login', {
        account: this.account,
        password: this.password
      })
        .then(function (response) {
          if (response.code === 1) {
            window.localStorage.setItem('token', response.token)
            layer.msg(response.msg, {icon: response.code})
            setTimeout(that.reload('user'), 5000)
          } else {
            layer.msg(response.msg, {icon: response.code})
          }
        })
    },
    register () {
      this.redirect('register')
    }
  }
}
</script>

<style>
    #body {
        height: auto;
        overflow: hidden;
    }
    label {
        margin: 0;
        padding: 0;
    }
    #footer {
        background: #393D49;
    }
    body{
        /*font: 12px/150% Arial,Verdana,"\5b8b\4f53";*/
        color: #666;
        /*background: #fff;*/
        margin: 0;
        padding: 0;
        /*font-size: 14px;*/
        _background-attachment: fixed;
    }
    .u_header {
        width: 100%;
        height: 68px;
        background: #393D49;
        overflow: hidden;
        box-shadow: 0 0 82px rgba(0,10,100,0.3);
        -moz-box-shadow: 0 0 82px rgba(0,10,100,0.3);
        -webkit-box-shadow: 0 0 82px rgba(0,10,100,0.3);
        box-sizing: border-box;
    }
    .u_header .u_header-box{
        width: 1180px;
        height: 58px;
        margin: 5px auto;
        overflow: hidden;
        min-width: 1120px;
        max-width: 1200px;
    }
    .u_header .u_header-box .u_logo{
        width: 228px;
        height: 68px;
        float: left;
    }
    .u_header .u_header-box .font {
        margin-top: 20px;
    }
    .u_header .u_header-box .u_logo span{
        color: #fff;
        font-size: 18px;
        font-weight: 400;
    }
    .body {
        width: 100%;
        height: auto;
        overflow: hidden;
        background: #fff;
    }
    .body .body-box {
        width: 1180px;
        height: auto;
        margin: 68px auto;
        overflow: hidden;
        min-width: 1120px;
        max-width: 1200px;
    }
    .body .body-box .body-left {
        width: 50%;
        float: left;
        border-right: 1px solid rgba(0,0,0,.07);
    }
    .body .body-box .body-right {
        width: 49%;
        float: right;
    }
    .input-item {
        position: relative;
        border: solid 1px #ddd;
        width: 398px;
        height: 52px;
        z-index: 0;
        margin: auto auto 38px auto;
    }
    .input-item label {
        float: left;
        width: 90px;
        height: 52px;
        line-height: 52px;
        padding-left: 20px;
    }
    .input-item .field {
        border: 0 none;
        font-size: 14px;
        width: 190px;
        height: 19px;
        padding-bottom: 11px;
        padding-left: 20px;
        padding-top: 16px;
        position:relative;
        z-index:9999;
        background:transparent;
    }
    .txt {
        position: absolute;
        z-index: 2;
        line-height: 46px;
        margin-left: 20px;
        margin-top: 1px;
        font-size: 14px;
        font-family: "Microsoft YaHei","Hiragino Sans GB";
        color: rgb(204, 204, 204);
        display: inline;
    }
    .loginact {
        background: #393D49;
        text-align: center;
        line-height: 46px;
        border: 0;
        font-size: 16px;
    }
    .login {
        width: 100%;
        height: 54px;
        color: #fff;
        font-family: "Microsoft YaHei","Hiragino Sans GB";
    }
    .register {
        width: 100%;
        height: 54px;
        color: #fff;
        font-family: "Microsoft YaHei","Hiragino Sans GB";
    }
    .register a:hover {
        color: #fff;
    }
    .loginact a:hover {
        color: #fff;
    }
    .login-right-box {
        margin-left: 68px;
    }
    .login-right-box .font {
        color: #888888;
    }
    .login-right-box .font strong a {
        text-decoration: underline;
        color: #393D49;
        font-size: 16px;
    }
</style>